package com.winning.yanghao.designpattern.singleton.seriable;

import java.io.Serializable;

public class Seriable implements Serializable {

    private static final Seriable INSTANCE = new Seriable();

    private Seriable(){}

    public static Seriable getInstance(){
        return INSTANCE;
    }

    /**
     * JVM自动调用的
     * 该方法能保证序列化和反序列化后对象是同一个对象
     * @return
     */
    private Object readResolve(){
        return INSTANCE;
    }

}
